﻿using ASmile.Com;
using ASmile.Com.GridView;
using ASmile.DBModel;
using ASmile.Extend;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ASmile.Win.DaBLL
{
    public class GridViewBLL : BLLCrud<ArgGetList, Sys_GridColumn>, IGridViewBLL
    {
        protected override string ControllerName => "SysManage/GridView";

        public ApiResultList<Sys_GridColumn> GetColumnInfo(ArgGetList arg)
        {
            return GetResultList<Sys_GridColumn>(arg);
        }

        public ApiResult SetColumnIndex(ArgSetSortNo arg)
        {
            return GetResult(arg);
        }

        public ApiResult SwapOrderNo(ArgSwapOrderNo arg)
        {
            return GetResult(arg);
        }
    }

    class GridViewBLL_bak : BLLBase//, IGridViewBLL
    {
        protected override string ControllerName => "SysManage/GridView";

        //public string SearchForm { get; internal set; }

        /// <summary>
        /// 根据form名称及dgv名称获取列名
        /// </summary>
        /// <param name="formName">窗体名称</param>
        /// <param name="dgvName">dgv名称，null查询所有</param>
        /// <returns></returns>
        public ApiResultList<Sys_GridColumn> GetColumnInfo(ArgGetList arg)
        {
            return GetResultList<Sys_GridColumn>(arg);
        }
        ///// <summary>
        ///// 获取分页数据
        ///// </summary>
        //public List<Sys_GridColumn> GetData(int pageNo, int pageSize, string searchVal, out int rowCount)
        //{
        //    var r = GetResultList<Sys_GridColumn>(new ArgPageData
        //    {
        //        PageNo = pageNo,
        //        PageSize = pageSize,
        //        SearchVal = searchVal,
        //        //TagData = SearchForm,
        //        AdSearchList = AdSearchList
        //    });
        //    rowCount = r.count;
        //    return r.data;
        //}
        public ApiResultList<Sys_GridColumn> GetData(ArgPageData arg)
        {
            return GetResultList<Sys_GridColumn>(arg);
        }


        /// <summary>
        /// 新增
        /// </summary>
        public virtual ApiResult<string> Add(Sys_GridColumn model)
        {
            var r = GetResult<string>(model);
            return r;
        }
        /// <summary>
        /// 更新
        /// </summary>
        public virtual ApiResult<string> Edit(Sys_GridColumn model)
        {
            var r = GetResult<string>(model);
            return r;
        }
        /// <summary>
        /// 删除
        /// </summary>
        public ApiResult Del(Sys_GridColumn model)
        {
            var r = GetResult<string>(model);
            return r;
        }

        /// <summary>
        /// 修改列索引(排序) ,只需要赋值 ,Id 与 ColumnIndex
        /// </summary>
        public ApiResult SetColumnIndex(ArgSetSortNo arg)
        {
            return GetResult(arg);
        }
        public ApiResult SwapOrderNo(ArgSwapOrderNo arg)
        {
            return GetResult(arg);
        }
    }
}
